<%@page import="com.fasterxml.jackson.annotation.JsonInclude.Include"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="zh-CN">
	<%@ include file="/WEB-INF/include-head.jsp" %>
	<script type="text/javascript">
		$(function () {
			$("#btn0").click(function () {
				$.ajax({
					"url":"test/quyuejiao2.ht",	//请求目标资源的地址
					"type":"post",				    //请求方式
					"data":"'name':'张三'",			    //请求体
					"contentType":"application/json;charset=UTF-8",//设置请求体的内容类型
					"dataType":"json",			
					"success":function(respons){//服务器端处理请求成功后调用的回调函数
						/* alert("成功"); */
						/* alert(respons); */
						alert("现在带你跳到返回的json数据对象里面的");
						/* 这就是一个数组 */
						/* var resourcespath0 = respons[0].resourcespath;
						alert(json); */
						
						alert("for循环开始,需要循环"+respons.length+"次");
						
						for(i=0;i<respons.length;i++){
							alert(respons[i].resourcespath);
						}
						
					},
					"error":function(respons){  //服务器端处理请求失败后调用的回调函数
						alert("失败了");
						alert(respons);
					}
				});
			})
		})

	</script>
	
	<style type="text/css"> 
		#divPicture{text-align: center;}
	</style>
  <body>
  		<%@ include file="/WEB-INF/include-nav.jsp" %>
    <div class="container-fluid">
			<%@ include file="/WEB-INF/include-sidebar.jsp" %>
    </div>
    <div id="divPicture" style="text-align: center;">
    	<h1> 最拉胯的 —— 图片浏览 </h1>
    		<br>
    		<a href="Picture/pler.ht?index=1">点击访问图片1</a>&nbsp;&nbsp;&nbsp;&nbsp;
    		<a href="Picture/pler.ht?index=2">点击访问图片2</a>&nbsp;&nbsp;&nbsp;&nbsp;
    		<a href="Picture/pler.ht?index=3">点击访问图片3</a>&nbsp;&nbsp;&nbsp;&nbsp;
    		<br>
    		<br>
    		<button id="btn0">获取json数据Ajax</button>
    		&nbsp;
    		<a href="test/quyuejiao1.ht">获取json数据</a>
    </div>
  </body>
</html>
